<template>
<div>
  <el-form :model="form" :inline="true" label-position="left">
    <el-form-item label="报修名称" label-width="100px">
      <el-col :span="16">
        <el-input v-model="form.name" autocomplete="off" placeholder="请输入报修名称" style="width: 220px"></el-input>
      </el-col>
    </el-form-item>
    <el-form-item label="门牌号" label-width="100px">
      <el-col :span="16">
        <el-input v-model="form.door" autocomplete="off" placeholder="请输入门牌号" style="width: 220px"></el-input>
      </el-col>
    </el-form-item>
    <el-form-item label="报修内容" label-width="100px">
      <el-col :span="16">
        <el-input v-model="form.content" autocomplete="off" placeholder="请输入保修内容" style="width: 220px"  type="textarea"
                  :autosize="{ minRows: 2, maxRows: 4}"></el-input>
      </el-col>
    </el-form-item>
    <el-form-item label="保修备注" label-width="100px">
      <el-col :span="16">
        <el-input v-model="form.note" autocomplete="off" placeholder="请输入备注" style="width: 220px"></el-input>
      </el-col>
    </el-form-item>
    <el-form-item label="姓名" label-width="100px">
      <el-col :span="16">
        <el-input v-model="form.username" autocomplete="off" placeholder="请输入姓名" style="width: 220px"></el-input>
      </el-col>
    </el-form-item>
    <el-form-item label="手机号" label-width="100px">
      <el-col :span="16">
        <el-input v-model="form.phone" autocomplete="off" placeholder="请输入手机号" style="width: 220px" maxlength="11"></el-input>
      </el-col>
    </el-form-item>
    <el-form-item label="保修日期" label-width="100px">
      <el-col :span="16">
        <el-date-picker
            v-model="form.fixDate"
            type="date"
            placeholder="选择日期"
            format="yyyy 年 MM 月 dd 日"
            value-format="yyyy-MM-dd">
        </el-date-picker>
      </el-col>
    </el-form-item>

  </el-form>
  <div slot="footer" class="dialog-footer">
    <el-button @click="cancel">取 消</el-button>
    <el-button type="primary" @click="saveKehu">确 定</el-button>
  </div>
</div>
</template>

<script>
import request from "@/utils/request";

export default {
  name: "Fix",
  data(){
    return{
      form:{
        id:"",
        orderId:"",
        name:"",
        username:"",
        door:"",
        content:"",
        fixDate:"",
        note:"",
        phone:""
      }
    };
  },
  methods:{
    cancel(){
      this.form=[]
    },
    saveKehu(){
      request.post("fix",this.form).then(res =>{
        if (res.code=="200"){
          this.$message.success("新增报修成功")
          this.form=[]
        }else {
          this.$message.error("新增报修失败")
        }
      })
    }

  }
}
</script>

<style scoped>

</style>